<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<head>
    <title>氪金眼答题卡识别系统</title>
    <!-- Meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="/favicon.ico">
    <link href='/assets/css/fontstyle.css' rel='stylesheet' type='text/css'>
    <!-- Global CSS -->
    <link rel="stylesheet" href="/assets/plugins/bootstrap/css/bootstrap.min.css">
    <!-- Plugins CSS -->
    <link rel="stylesheet" href="/assets/plugins/font-awesome/css/font-awesome.css">
    <link rel="stylesheet" href="/assets/plugins/prism/prism.css">
    <link rel="stylesheet" href="/assets/plugins/elegant_font/css/style.css">

    <!-- Theme CSS -->
    <link id="theme-style" rel="stylesheet" href="/assets/css/styles.css">
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body class="landing-page">
    <div class="page-wrapper">
        <!-- ******Header****** -->
        <header id="header" class="header">
            <div class="container">
                <div class="branding">
                    <h1 class="logo">
                        <a href="#">
                            <span aria-hidden="true" class="glyphicon glyphicon-eye-open"></span>
                            <span class="text-bold">氪金眼</span><span class="text-highlight">答题卡识别系统</span>
                        </a>
                    </h1>
                </div><!--//branding-->
                <ol class="breadcrumb">
                    <li><a href="/">首页</a></li>
                    <li class="active">历史提交</li>
                </ol>
            </div><!--//container-->
        </header><!--//header-->
        <div class="doc-wrapper">
            <div class="container">
                <div class="doc-body">
                  <div class="row">
                    <div class="progress-wrapper col-md-6 col-md-offset-2">
                      <div class="progress">
                        <div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="{{diskUsage}}"
                        aria-valuemin="0" aria-valuemax="100" style="width:{{diskUsage}}%">
                          存储空间已使用：{{diskUsage}}%
                        </div>
                      </div>
                    </div>
                    <div class="col-md-4">
                      <button type="button" class="btn btn-xs btn-success clearStorage">清理垃圾</button>
                    </div>
                  </div>
                  <div class="row">
                    <div class="table-container col-md-10 col-md-offset-1">
                      <table class="table">
                      <thead>
                          <th class="text-center">ID</th>
                          <th class="text-center">已处理 / 总数</th>
                          <th class="text-center">操作</th>
                      </thead>
                      <tbody>
                        {% for t in records %}
                        <tr>
                          <td class='text-center'><a href="/results/{{t[0]}}" target="_blank">{{t[0]}}</a></td>
                          <td class='text-center'>{{t[1]}} / {{t[2]}}</td>
                          <td class='text-center'>
                            <a role="button" class="btn btn-info" target="_blank" href="/results/{{t[0]}}">查看</a>
                            {% if t[1] == t[2] %}
                              <button type="button" class="deleteRecord btn btn-danger" token="{{t[0]}}">删除</button>
                            {% else %}
                              <button type="button" class="deleteRecord btn btn-danger" token="{{t[0]}}" disabled>删除</button>
                            {% endif %}
                          </td>
                        </tr>
                        {% endfor %}
                      </tbody>
                      </table>
                    </div>
                  </div>
                </div><!--//doc-body-->
            </div><!--//container-->
        </div><!--//doc-wrapper-->

    </div><!--//page-wrapper-->

    <footer id="footer" class="footer text-center">
        <div class="container">
            <!--/* This template is released under the Creative Commons Attribution 3.0 License. Please keep the attribution link below when using for your own project. Thank you for your support. :) If you'd like to use the template without the attribution, you can check out other license options via our website: themes.3rdwavemedia.com */-->
            <small class="copyright">Designed with <i class="fa fa-heart"></i> by <a href="http://themes.3rdwavemedia.com/" targe="_blank">Xiaoying Riley</a> for developers, modified by <a href="http://heqing.me/" targe="_blank">Heqing Ya</a> </small>

        </div><!--//container-->
    </footer><!--//footer-->


    <!-- Main Javascript -->



    <script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>
    <script type="text/javascript" src="/assets/plugins/jquery-1.12.3.min.js"></script>
    <script type="text/javascript" src="/assets/plugins/bootstrap/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="/assets/plugins/prism/prism.js"></script>
    <script type="text/javascript" src="/assets/plugins/jquery-scrollTo/jquery.scrollTo.min.js"></script>
    <script type="text/javascript" src="/assets/plugins/jquery-match-height/jquery.matchHeight-min.js"></script>
    <script type="text/javascript" src="/assets/js/main.js"></script>
    <script>
        function deleteRecord(token) {
          var confirmed = confirm("确定要删除该条记录吗？");
          if (confirmed == true) {
            $.post("/delete/" + token, function (data) {
              console.log(data.status);
              if (data.status === "success") {
                $(".deleteRecord[token='" + token + "']").closest("tr").remove();
              }
            }, 'json');
          }
        }

        function clearStorage() {
          $.post("/clear", function (data) {
            if (data.status === "success") {
              location.reload();
            }
          }, 'json');
        }
        $(document).ready(function(){
          $(".deleteRecord").click(function () {
            deleteRecord($(this).attr("token"));
          });
          $(".clearStorage").click(function () {
            var confirmed = confirm("确定要清理垃圾吗？");
            if (confirmed == true) {
              clearStorage();
            }
          });
        });



    </script>
</body>
</html>
